<?php

namespace Jb\Navigation;

use Jb\Object,
    Jb\Navigation\Navigation;

class Menu extends Navigation {

    private $aPages = array();

    public function addPage(Navigation $menuPage) {
        $menuPage->setParent($this);
        \array_push($this->aPages, $menuPage);
    }

    public function removePage(Navigation $menuPage) {
        
    }

    public function compareTo(Object $currentRoute) {
        foreach($this->aPages as $oPage) {
            $oPage->compareTo($currentRoute);
        }

        // If a parent has its own route(s), it will also compare itself
        // against the current route.
        if($this->hasRoutes()) {
            parent::compareTo($currentRoute);
        }
    }

    public function getPages() {
        return $this->aPages;
    }

}

?>
